FROM golang:1.13 as builder

ENV GOPROXY https://goproxy.cn
WORKDIR /app
COPY . .
RUN GOOS=linux CGO_ENABLED=0 go build -ldflags="-s -w" -installsuffix cgo -o appMain

FROM alpine:latest as prod
USER root
WORKDIR /app

COPY --from=builder /usr/local/go/lib/time/zoneinfo.zip /opt/zoneinfo.zip
COPY --from=builder /app/appMain /app
COPY --from=builder /app/template /app/template
COPY --from=builder /app/.env /app/.env
COPY --from=builder /app/static /app/static
ENV ZONEINFO /opt/zoneinfo.zip

CMD [ "/app/appMain" ]
